package com.utils;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *  各种单号创建
 */
public class NoCreator {

    /**
     * 创建入库单
     * @return IN+年月日时分秒毫秒+4位随机数
     */
    public static String createInNo(){
        StringBuffer string=new StringBuffer();
        SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        int rand=(int) (Math.random()*999)+1000;
        string.append("IN").append(format.format(new Date())).append(rand);
        return string.toString();
    }
    /**
     * 创建出库单
     * @return IN+年月日时分秒毫秒+4位随机数
     */
    public static String createOutNo(){
        StringBuffer string=new StringBuffer();
        SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        int rand=(int) (Math.random()*999)+1000;
        string.append("OU").append(format.format(new Date())).append(rand);
        return string.toString();
    }

    /**
     * 创建订单单
     * @return IN+年月日时分秒毫秒+4位随机数
     */
    public static String createODNo(){
        StringBuffer string=new StringBuffer();
        SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        int rand=(int) (Math.random()*999)+1000;
        string.append("OD").append(format.format(new Date())).append(rand);
        return string.toString();
    }
    /**
     * 创建海南国租快递单号
     * @return IN+年月日时分秒毫秒+4位随机数
     */
    public static String createKDNo(){
        StringBuffer string=new StringBuffer();
        SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        int rand=(int) (Math.random()*999)+1000;
        string.append("KD").append(format.format(new Date())).append(rand);
        return string.toString();
    }

    /**
     * 创建订单外部订单号
     * @return IN+年月日时分秒毫秒+4位随机数
     */
    public static String createOODNNo(){
        StringBuffer string=new StringBuffer();
        SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmssSSS");
        int rand=(int) (Math.random()*999)+1000;
        string.append("OODN").append(format.format(new Date())).append(rand);
        return string.toString();
    }

//    public static void main (String[] args) {
//        System.out.println(1);
//        System.out.println(createInNo());
//    }
}
